home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / dev / c / libiconv_src.lha / autoconf / ltmain.sh < prev   
Encoding:
Text File  |  2000-11-07  |  69.2 KB  |  2,456 lines

  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun ltconfig.
  3. #
  4. # Copyright (C) 1996-1998 Free Software Foundation, Inc.
  5. # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. #
  21. # As a special exception to the GNU General Public License, if you
  22. # distribute this file as part of a program that contains a
  23. # configuration script generated by Autoconf, you may include it under
  24. # the same distribution terms that you use for the rest of that program.
  25.  
  26. # The name of this program.
  27. progname=`$echo "$0" | sed 's%^.*/%%'`
  28. modename="$progname"
  29.  
  30. # Constants.
  31. PROGRAM=ltmain.sh
  32. PACKAGE=libtool
  33. VERSION=1.2
  34.  
  35. default_mode=
  36. help="Try \`$progname --help' for more information."
  37. magic="%%%MAGIC variable%%%"
  38. mkdir="mkdir"
  39. mv="mv -f"
  40. rm="rm -f"
  41.  
  42. # Sed substitution that helps us do robust quoting.  It backslashifies
  43. # metacharacters that are still active within double-quoted strings.
  44. Xsed='sed -e s/^X//'
  45. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  46.  
  47. # NLS nuisances.
  48. # Only set LANG and LC_ALL to C if already set.
  49. # These must not be set unconditionally because not all systems understand
  50. # e.g. LANG=C (notably SCO).
  51. if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
  52. if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
  53.  
  54. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  55.   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  56.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  57.   exit 1
  58. fi
  59.  
  60. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  61.   echo "$modename: not configured to build any kind of library" 1>&2
  62.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  63.   exit 1
  64. fi
  65.  
  66. # Global variables.
  67. mode=$default_mode
  68. nonopt=
  69. prev=
  70. prevopt=
  71. run=
  72. show="$echo"
  73. show_help=
  74. execute_dlfiles=
  75.  
  76. # Parse our command line options once, thoroughly.
  77. while test $# -gt 0
  78. do
  79.   arg="$1"
  80.   shift
  81.  
  82.   case "$arg" in
  83.   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  84.   *) optarg= ;;
  85.   esac
  86.  
  87.   # If the previous option needs an argument, assign it.
  88.   if test -n "$prev"; then
  89.     case "$prev" in
  90.     execute_dlfiles)
  91.       eval "$prev=\"\$$prev \$arg\""
  92.       ;;
  93.     *)
  94.       eval "$prev=\$arg"
  95.       ;;
  96.     esac
  97.  
  98.     prev=
  99.     prevopt=
  100.     continue
  101.   fi
  102.  
  103.   # Have we seen a non-optional argument yet?
  104.   case "$arg" in
  105.   --help)
  106.     show_help=yes
  107.     ;;
  108.  
  109.   --version)
  110.     echo "$PROGRAM (GNU $PACKAGE) $VERSION"
  111.     exit 0
  112.     ;;
  113.  
  114.   --dry-run | -n)
  115.     run=:
  116.     ;;
  117.  
  118.   --features)
  119.     echo "host: $host"
  120.     if test "$build_libtool_libs" = yes; then
  121.       echo "enable shared libraries"
  122.     else
  123.       echo "disable shared libraries"
  124.     fi
  125.     if test "$build_old_libs" = yes; then
  126.       echo "enable static libraries"
  127.     else
  128.       echo "disable static libraries"
  129.     fi
  130.     exit 0
  131.     ;;
  132.  
  133.   --finish) mode="finish" ;;
  134.  
  135.   --mode) prevopt="--mode" prev=mode ;;
  136.   --mode=*) mode="$optarg" ;;
  137.  
  138.   --quiet | --silent)
  139.     show=:
  140.     ;;
  141.  
  142.   -dlopen)
  143.     prevopt="-dlopen"
  144.     prev=execute_dlfiles
  145.     ;;
  146.  
  147.   -*)
  148.     $echo "$modename: unrecognized option \`$arg'" 1>&2
  149.     $echo "$help" 1>&2
  150.     exit 1
  151.     ;;
  152.  
  153.   *)
  154.     nonopt="$arg"
  155.     break
  156.     ;;
  157.   esac
  158. done
  159.  
  160. if test -n "$prevopt"; then
  161.   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  162.   $echo "$help" 1>&2
  163.   exit 1
  164. fi
  165.  
  166. if test -z "$show_help"; then
  167.  
  168.   # Infer the operation mode.
  169.   if test -z "$mode"; then
  170.     case "$nonopt" in
  171.     *cc | *++ | gcc* | *-gcc*)
  172.       mode=link
  173.       for arg
  174.       do
  175.         case "$arg" in
  176.         -c)
  177.            mode=compile
  178.            break
  179.            ;;
  180.         esac
  181.       done
  182.       ;;
  183.     *db | *dbx)
  184.       mode=execute
  185.       ;;
  186.     *install*|cp|mv)
  187.       mode=install
  188.       ;;
  189.     *rm)
  190.       mode=uninstall
  191.       ;;
  192.     *)
  193.       # If we have no mode, but dlfiles were specified, then do execute mode.
  194.       test -n "$execute_dlfiles" && mode=execute
  195.  
  196.       # Just use the default operation mode.
  197.       if test -z "$mode"; then
  198.         if test -n "$nonopt"; then
  199.           $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  200.         else
  201.           $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  202.         fi
  203.       fi
  204.       ;;
  205.     esac
  206.   fi
  207.  
  208.   # Only execute mode is allowed to have -dlopen flags.
  209.   if test -n "$execute_dlfiles" && test "$mode" != execute; then
  210.     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  211.     $echo "$help" 1>&2
  212.     exit 1
  213.   fi
  214.  
  215.   # Change the help message to a mode-specific one.
  216.   generic_help="$help"
  217.   help="Try \`$modename --help --mode=$mode' for more information."
  218.  
  219.   # These modes are in order of execution frequency so that they run quickly.
  220.   case "$mode" in
  221.   # libtool compile mode
  222.   compile)
  223.     modename="$modename: compile"
  224.     # Get the compilation command and the source file.
  225.     base_compile=
  226.     lastarg=
  227.     srcfile="$nonopt"
  228.     suppress_output=
  229.  
  230.     for arg
  231.     do
  232.       # Accept any command-line options.
  233.       case "$arg" in
  234.       -o)
  235.     $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
  236.     $echo "$help" 1>&2
  237.     exit 1
  238.     ;;
  239.  
  240.       -static)
  241.     build_libtool_libs=no
  242.     build_old_libs=yes
  243.     continue
  244.     ;;
  245.       esac
  246.  
  247.       # Accept the current argument as the source file.
  248.       lastarg="$srcfile"
  249.       srcfile="$arg"
  250.  
  251.       # Aesthetically quote the previous argument.
  252.  
  253.       # Backslashify any backslashes, double quotes, and dollar signs.
  254.       # These are the only characters that are still specially
  255.       # interpreted inside of double-quoted scrings.
  256.       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  257.  
  258.       # Double-quote args containing other shell metacharacters.
  259.       # Many Bourne shells cannot handle close brackets correctly in scan
  260.       # sets, so we specify it separately.
  261.       case "$lastarg" in
  262.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  263.     lastarg="\"$lastarg\""
  264.     ;;
  265.       esac
  266.  
  267.       # Add the previous argument to base_compile.
  268.       if test -z "$base_compile"; then
  269.     base_compile="$lastarg"
  270.       else
  271.     base_compile="$base_compile $lastarg"
  272.       fi
  273.     done
  274.  
  275.     # Get the name of the library object.
  276.     libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  277.  
  278.     # Recognize several different file suffixes.
  279.     xform='[cCFSfms]'
  280.     case "$libobj" in
  281.     *.ada) xform=ada ;;
  282.     *.adb) xform=adb ;;
  283.     *.ads) xform=ads ;;
  284.     *.asm) xform=asm ;;
  285.     *.c++) xform=c++ ;;
  286.     *.cc) xform=cc ;;
  287.     *.cpp) xform=cpp ;;
  288.     *.cxx) xform=cxx ;;
  289.     *.f90) xform=f90 ;;
  290.     *.for) xform=for ;;
  291.     esac
  292.  
  293.     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  294.  
  295.     case "$libobj" in
  296.     *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
  297.     *)
  298.       $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
  299.       exit 1
  300.       ;;
  301.     esac
  302.  
  303.     if test -z "$base_compile"; then
  304.       $echo "$modename: you must specify a compilation command" 1>&2
  305.       $echo "$help" 1>&2
  306.       exit 1
  307.     fi
  308.  
  309.     # Delete any leftover library objects.
  310.     if test "$build_old_libs" = yes; then
  311.       $run $rm $obj $libobj
  312.       trap "$run $rm $obj $libobj; exit 1" 1 2 15
  313.     else
  314.       $run $rm $libobj
  315.       trap "$run $rm $libobj; exit 1" 1 2 15
  316.     fi
  317.  
  318.     # Only build a PIC object if we are building libtool libraries.
  319.     if test "$build_libtool_libs" = yes; then
  320.       # Without this assignment, base_compile gets emptied.
  321.       fbsd_hideous_sh_bug=$base_compile
  322.  
  323.       # All platforms use -DPIC, to notify preprocessed assembler code.
  324.       $show "$base_compile$pic_flag -DPIC $srcfile"
  325.       if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
  326.       else
  327.         test -n "$obj" && $run $rm $obj
  328.         exit 1
  329.       fi
  330.  
  331.       # If we have no pic_flag, then copy the object into place and finish.
  332.       if test -z "$pic_flag"; then
  333.         $show "$LN_S $obj $libobj"
  334.         $run $LN_S $obj $libobj
  335.         exit $?
  336.       fi
  337.  
  338.       # Just move the object, then go on to compile the next one
  339.       $show "$mv $obj $libobj"
  340.       $run $mv $obj $libobj || exit 1
  341.  
  342.       # Allow error messages only from the first compilation.
  343.       suppress_output=' >/dev/null 2>&1'
  344.     fi
  345.  
  346.     # Only build a position-dependent object if we build old libraries.
  347.     if test "$build_old_libs" = yes; then
  348.       # Suppress compiler output if we already did a PIC compilation.
  349.       $show "$base_compile $srcfile$suppress_output"
  350.       if $run eval "$base_compile \$srcfile$suppress_output"; then :
  351.       else
  352.         $run $rm $obj $libobj
  353.         exit 1
  354.       fi
  355.     fi
  356.  
  357.     # Create an invalid libtool object if no PIC, so that we do not
  358.     # accidentally link it into a program.
  359.     if test "$build_libtool_libs" != yes; then
  360.       $show "echo timestamp > $libobj"
  361.       $run eval "echo timestamp > \$libobj" || exit $?
  362.     fi
  363.  
  364.     exit 0
  365.     ;;
  366.  
  367.   # libtool link mode
  368.   link)
  369.     modename="$modename: link"
  370.     CC="$nonopt"
  371.     allow_undefined=yes
  372.     compile_command="$CC"
  373.     finalize_command="$CC"
  374.  
  375.     compile_shlibpath=
  376.     finalize_shlibpath=
  377.     deplibs=
  378.     dlfiles=
  379.     dlprefiles=
  380.     export_dynamic=no
  381.     hardcode_libdirs=
  382.     libobjs=
  383.     link_against_libtool_libs=
  384.     ltlibs=
  385.     objs=
  386.     olibobjs=
  387.     prev=
  388.     prevarg=
  389.     release=
  390.     rpath=
  391.     perm_rpath=
  392.     temp_rpath=
  393.     vinfo=
  394.  
  395.     # We need to know -static, to get the right output filenames.
  396.     for arg
  397.     do
  398.       case "$arg" in
  399.       -all-static | -static)
  400.         if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  401.         $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  402.         fi
  403.         build_libtool_libs=no
  404.     build_old_libs=yes
  405.         break
  406.         ;;
  407.       esac
  408.     done
  409.  
  410.     # See if our shared archives depend on static archives.
  411.     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  412.  
  413.     # Go through the arguments, transforming them on the way.
  414.     for arg
  415.     do
  416.       # If the previous option needs an argument, assign it.
  417.       if test -n "$prev"; then
  418.         case "$prev" in
  419.         output)
  420.           compile_command="$compile_command @OUTPUT@"
  421.           finalize_command="$finalize_command @OUTPUT@"
  422.           ;;
  423.         esac
  424.  
  425.         case "$prev" in
  426.         dlfiles|dlprefiles)
  427.           case "$arg" in
  428.           *.la | *.lo) ;;  # We handle these cases below.
  429.           *)
  430.             dlprefiles="$dlprefiles $arg"
  431.             test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
  432.             prev=
  433.             ;;
  434.           esac
  435.           ;;
  436.     release)
  437.       release="-$arg"
  438.       prev=
  439.       continue
  440.       ;;
  441.         rpath)
  442.           rpath="$rpath $arg"
  443.       prev=
  444.       continue
  445.       ;;
  446.         *)
  447.           eval "$prev=\"\$arg\""
  448.           prev=
  449.           continue
  450.           ;;
  451.         esac
  452.       fi
  453.  
  454.       prevarg="$arg"
  455.  
  456.       case "$arg" in
  457.       -all-static)
  458.     if test -n "$link_static_flag"; then
  459.           compile_command="$compile_command $link_static_flag"
  460.       finalize_command="$finalize_command $link_static_flag"
  461.         fi
  462.         continue
  463.     ;;
  464.  
  465.       -allow-undefined)
  466.     # FIXME: remove this flag sometime in the future.
  467.     $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  468.     continue
  469.     ;;
  470.  
  471.       -dlopen)
  472.         prev=dlfiles
  473.         continue
  474.         ;;
  475.  
  476.       -dlpreopen)
  477.         prev=dlprefiles
  478.         continue
  479.         ;;
  480.  
  481.       -export-dynamic)
  482.         if test "$export_dynamic" != yes; then
  483.           export_dynamic=yes
  484.       if test -n "$export_dynamic_flag_spec"; then
  485.         eval arg=\"$export_dynamic_flag_spec\"
  486.       else
  487.         arg=
  488.       fi
  489.  
  490.           # Add the symbol object into the linking commands.
  491.       compile_command="$compile_command @SYMFILE@"
  492.       finalize_command="$finalize_command @SYMFILE@"
  493.         fi
  494.         ;;
  495.  
  496.       -L*)
  497.         dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
  498.         case "$dir" in
  499.         /* | [A-Za-z]:\\*)
  500.       # Add the corresponding hardcode_libdir_flag, if it is not identical.
  501.           ;;
  502.         *)
  503.           $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
  504.           exit 1
  505.           ;;
  506.         esac
  507.         deplibs="$deplibs $arg"
  508.         ;;
  509.  
  510.       -l*) deplibs="$deplibs $arg" ;;
  511.  
  512.       -no-undefined)
  513.     allow_undefined=no
  514.     continue
  515.     ;;
  516.  
  517.       -o) prev=output ;;
  518.  
  519.       -release)
  520.     prev=release
  521.     continue
  522.     ;;
  523.  
  524.       -rpath)
  525.         prev=rpath
  526.         continue
  527.         ;;
  528.  
  529.       -static)
  530.     # If we have no pic_flag, then this is the same as -all-static.
  531.     if test -z "$pic_flag" && test -n "$link_static_flag"; then
  532.           compile_command="$compile_command $link_static_flag"
  533.       finalize_command="$finalize_command $link_static_flag"
  534.         fi
  535.     continue
  536.     ;;
  537.  
  538.       -version-info)
  539.         prev=vinfo
  540.         continue
  541.         ;;
  542.  
  543.       # Some other compiler flag.
  544.       -* | +*)
  545.     # Unknown arguments in both finalize_command and compile_command need
  546.     # to be aesthetically quoted because they are evaled later.
  547.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  548.     case "$arg" in
  549.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  550.       arg="\"$arg\""
  551.       ;;
  552.     esac
  553.         ;;
  554.  
  555.       *.o | *.a)
  556.         # A standard object.
  557.         objs="$objs $arg"
  558.         ;;
  559.  
  560.       *.lo)
  561.         # A library object.
  562.     if test "$prev" = dlfiles; then
  563.       dlfiles="$dlfiles $arg"
  564.       if test "$build_libtool_libs" = yes; then
  565.         prev=
  566.         continue
  567.       else
  568.         # If libtool objects are unsupported, then we need to preload.
  569.         prev=dlprefiles
  570.       fi
  571.     fi
  572.  
  573.     if test "$prev" = dlprefiles; then
  574.       # Preload the old-style object.
  575.       dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'`
  576.       prev=
  577.     fi
  578.     libobjs="$libobjs $arg"
  579.     olibobjs="$olibobjs "`$echo "X$arg" | $Xsed -e 's/\.lo$/\.o/'`
  580.         ;;
  581.  
  582.       *.la)
  583.         # A libtool-controlled library.
  584.  
  585.         dlname=
  586.         libdir=
  587.         library_names=
  588.         old_library=
  589.  
  590.         # Check to see that this really is a libtool archive.
  591.         if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
  592.         else
  593.           $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  594.           exit 1
  595.         fi
  596.  
  597.         # If there is no directory component, then add one.
  598.         case "$arg" in
  599.         */* | *\\*) . $arg ;;
  600.         *) . ./$arg ;;
  601.         esac
  602.  
  603.         if test -z "$libdir"; then
  604.           $echo "$modename: \`$arg' contains no -rpath information" 1>&2
  605.           exit 1
  606.         fi
  607.  
  608.         # Get the name of the library we link against.
  609.         linklib=
  610.         for l in $old_library $library_names; do
  611.           linklib="$l"
  612.         done
  613.  
  614.         if test -z "$linklib"; then
  615.           $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  616.           exit 1
  617.         fi
  618.  
  619.         # Find the relevant object directory and library name.
  620.         name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  621.         dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  622.         if test "X$dir" = "X$arg"; then
  623.           dir="$objdir"
  624.         else
  625.           dir="$dir/$objdir"
  626.         fi
  627.  
  628.         # This library was specified with -dlopen.
  629.         if test "$prev" = dlfiles; then
  630.           dlfiles="$dlfiles $arg"
  631.           if test -z "$dlname"; then
  632.             # If there is no dlname, we need to preload.
  633.             prev=dlprefiles
  634.           else
  635.             # We should not create a dependency on this library, but we
  636.         # may need any libraries it requires.
  637.         compile_command="$compile_command$dependency_libs"
  638.         finalize_command="$finalize_command$dependency_libs"
  639.             prev=
  640.             continue
  641.           fi
  642.         fi
  643.  
  644.         # The library was specified with -dlpreopen.
  645.         if test "$prev" = dlprefiles; then
  646.           # Prefer using a static library (so that no silly _DYNAMIC symbols
  647.           # are required to link).
  648.           if test -n "$old_library"; then
  649.             dlprefiles="$dlprefiles $dir/$old_library"
  650.           else
  651.             dlprefiles="$dlprefiles $dir/$linklib"
  652.           fi
  653.           prev=
  654.         fi
  655.  
  656.         if test "$build_libtool_libs" = yes && test -n "$library_names"; then
  657.           link_against_libtool_libs="$link_against_libtool_libs $arg"
  658.           if test -n "$shlibpath_var"; then
  659.             # Make sure the rpath contains only unique directories.
  660.             case "$temp_rpath " in
  661.             *" $dir "*) ;;
  662.             *) temp_rpath="$temp_rpath $dir" ;;
  663.             esac
  664.           fi
  665.  
  666.       # This is the magic to use -rpath.
  667.           if test -n "$hardcode_libdir_flag_spec"; then
  668.             if test -n "$hardcode_libdir_separator"; then
  669.               if test -z "$hardcode_libdirs"; then
  670.                 # Put the magic libdir with the hardcode flag.
  671.                 hardcode_libdirs="$libdir"
  672.                 libdir="@HARDCODE_LIBDIRS@"
  673.               else
  674.                 # Just accumulate the unique libdirs.
  675.         case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  676.         *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  677.           ;;
  678.         *)
  679.           hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  680.           ;;
  681.         esac
  682.                 libdir=
  683.               fi
  684.             fi
  685.  
  686.             if test -n "$libdir"; then
  687.               eval flag=\"$hardcode_libdir_flag_spec\"
  688.  
  689.               compile_command="$compile_command $flag"
  690.               finalize_command="$finalize_command $flag"
  691.             fi
  692.           elif test -n "$runpath_var"; then
  693.             # Do the same for the permanent run path.
  694.             case "$perm_rpath " in
  695.             *" $libdir "*) ;;
  696.             *) perm_rpath="$perm_rpath $libdir" ;;
  697.             esac
  698.           fi
  699.  
  700.  
  701.           case "$hardcode_action" in
  702.           immediate)
  703.             if test "$hardcode_direct" = no; then
  704.               compile_command="$compile_command $dir/$linklib"
  705.             elif test "$hardcode_minus_L" = no; then
  706.               compile_command="$compile_command -L$dir -l$name"
  707.             elif test "$hardcode_shlibpath_var" = no; then
  708.               compile_shlibpath="$compile_shlibpath$dir:"
  709.               compile_command="$compile_command -l$name"
  710.             fi
  711.             ;;
  712.  
  713.           relink)
  714.             # We need an absolute path.
  715.             case "$dir" in
  716.             /* | [A-Za-z]:\\*) ;;
  717.             *)
  718.               absdir=`cd "$dir" && pwd`
  719.               if test -z "$absdir"; then
  720.                 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  721.                 exit 1
  722.               fi
  723.               dir="$absdir"
  724.               ;;
  725.             esac
  726.  
  727.             if test "$hardcode_direct" = yes; then
  728.               compile_command="$compile_command $dir/$linklib"
  729.             elif test "$hardcode_minus_L" = yes; then
  730.               compile_command="$compile_command -L$dir -l$name"
  731.             elif test "$hardcode_shlibpath_var" = yes; then
  732.               compile_shlibpath="$compile_shlibpath$dir:"
  733.               compile_command="$compile_command -l$name"
  734.             fi
  735.             ;;
  736.  
  737.           *)
  738.             $echo "$modename: \`$hardcode_action' is an unknown hardcode action" 1>&2
  739.             exit 1
  740.             ;;
  741.           esac
  742.  
  743.           # Finalize command for both is simple: just hardcode it.
  744.           if test "$hardcode_direct" = yes; then
  745.             finalize_command="$finalize_command $libdir/$linklib"
  746.           elif test "$hardcode_minus_L" = yes; then
  747.             finalize_command="$finalize_command -L$libdir -l$name"
  748.           elif test "$hardcode_shlibpath_var" = yes; then
  749.             finalize_shlibpath="$finalize_shlibpath$libdir:"
  750.             finalize_command="$finalize_command -l$name"
  751.           else
  752.             # We cannot seem to hardcode it, guess we'll fake it.
  753.             finalize_command="$finalize_command -L$libdir -l$name"
  754.           fi
  755.         else
  756.           # Transform directly to old archives if we don't build new libraries.
  757.           if test -n "$pic_flag" && test -z "$old_library"; then
  758.             $echo "$modename: cannot find static library for \`$arg'" 1>&2
  759.             exit 1
  760.           fi
  761.  
  762.       # Here we assume that one of hardcode_direct or hardcode_minus_L
  763.       # is not unsupported.  This is valid on all known static and
  764.       # shared platforms.
  765.       if test "$hardcode_direct" != unsupported; then
  766.         test -n "$old_library" && linklib="$old_library"
  767.         compile_command="$compile_command $dir/$linklib"
  768.         finalize_command="$finalize_command $dir/$linklib"
  769.       else
  770.         compile_command="$compile_command -L$dir -l$name"
  771.         finalize_command="$finalize_command -L$dir -l$name"
  772.       fi
  773.         fi
  774.  
  775.     # Add in any libraries that this one depends upon.
  776.     compile_command="$compile_command$dependency_libs"
  777.     finalize_command="$finalize_command$dependency_libs"
  778.     continue
  779.         ;;
  780.  
  781.       # Some other compiler argument.
  782.       *)
  783.     # Unknown arguments in both finalize_command and compile_command need
  784.     # to be aesthetically quoted because they are evaled later.
  785.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  786.     case "$arg" in
  787.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  788.       arg="\"$arg\""
  789.       ;;
  790.     esac
  791.         ;;
  792.       esac
  793.  
  794.       # Now actually substitute the argument into the commands.
  795.       if test -n "$arg"; then
  796.     compile_command="$compile_command $arg"
  797.     finalize_command="$finalize_command $arg"
  798.       fi
  799.     done
  800.  
  801.     if test -n "$prev"; then
  802.       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  803.       $echo "$help" 1>&2
  804.       exit 1
  805.     fi
  806.  
  807.     if test -n "$vinfo" && test -n "$release"; then
  808.       $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2
  809.       $echo "$help" 1>&2
  810.       exit 1
  811.     fi
  812.  
  813.     oldlib=
  814.     oldobjs=
  815.     case "$output" in
  816.     "")
  817.       $echo "$modename: you must specify an output file" 1>&2
  818.       $echo "$help" 1>&2
  819.       exit 1
  820.       ;;
  821.  
  822.     */* | *\\*)
  823.       $echo "$modename: output file \`$output' must have no directory components" 1>&2
  824.       exit 1
  825.       ;;
  826.  
  827.     *.a)
  828.       # Now set the variables for building old libraries.
  829.       build_libtool_libs=no
  830.       build_old_libs=yes
  831.       oldlib="$output"
  832.       $show "$rm $oldlib"
  833.       $run $rm $oldlib
  834.       ;;
  835.  
  836.     *.la)
  837.       # Make sure we only generate libraries of the form `libNAME.la'.
  838.       case "$output" in
  839.       lib*) ;;
  840.       *)
  841.     $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2
  842.     $echo "$help" 1>&2
  843.     exit 1
  844.     ;;
  845.       esac
  846.  
  847.       name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  848.       eval libname=\"$libname_spec\"
  849.  
  850.       # All the library-specific variables (install_libdir is set above).
  851.       library_names=
  852.       old_library=
  853.       dlname=
  854.       current=0
  855.       revision=0
  856.       age=0
  857.  
  858.       if test -n "$objs"; then
  859.         $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  860.         exit 1
  861.       fi
  862.  
  863.       # How the heck are we supposed to write a wrapper for a shared library?
  864.       if test -n "$link_against_libtool_libs"; then
  865.         $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
  866.         exit 1
  867.       fi
  868.  
  869.       if test -n "$dlfiles$dlprefiles"; then
  870.         $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
  871.         # Nullify the symbol file.
  872.         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  873.         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  874.       fi
  875.  
  876.       if test -z "$rpath"; then
  877.         $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2
  878.     $echo "$help" 1>&2
  879.         exit 1
  880.       fi
  881.  
  882.       set dummy $rpath
  883.       if test $# -gt 2; then
  884.     $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  885.       fi
  886.       install_libdir="$2"
  887.  
  888.       # Parse the version information argument.
  889.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
  890.       set dummy $vinfo
  891.       IFS="$save_ifs"
  892.  
  893.       if test -n "$5"; then
  894.         $echo "$modename: too many parameters to \`-version-info'" 1>&2
  895.         $echo "$help" 1>&2
  896.         exit 1
  897.       fi
  898.  
  899.       test -n "$2" && current="$2"
  900.       test -n "$3" && revision="$3"
  901.       test -n "$4" && age="$4"
  902.  
  903.       # Check that each of the things are valid numbers.
  904.       case "$current" in
  905.       0 | [1-9] | [1-9][0-9]*) ;;
  906.       *)
  907.         $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  908.         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  909.         exit 1
  910.         ;;
  911.       esac
  912.  
  913.       case "$revision" in
  914.       0 | [1-9] | [1-9][0-9]*) ;;
  915.       *)
  916.         $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  917.         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  918.         exit 1
  919.         ;;
  920.       esac
  921.  
  922.       case "$age" in
  923.       0 | [1-9] | [1-9][0-9]*) ;;
  924.       *)
  925.         $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  926.         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  927.         exit 1
  928.         ;;
  929.       esac
  930.  
  931.       if test $age -gt $current; then
  932.         $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  933.         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  934.         exit 1
  935.       fi
  936.  
  937.       # Calculate the version variables.
  938.       version_vars="version_type current age revision"
  939.       case "$version_type" in
  940.       none) ;;
  941.  
  942.       linux)
  943.         version_vars="$version_vars major versuffix"
  944.         major=`expr $current - $age`
  945.         versuffix="$major.$age.$revision"
  946.         ;;
  947.  
  948.       osf)
  949.         version_vars="$version_vars versuffix verstring"
  950.         major=`expr $current - $age`
  951.         versuffix="$current.$age.$revision"
  952.         verstring="$versuffix"
  953.  
  954.         # Add in all the interfaces that we are compatible with.
  955.         loop=$age
  956.         while test $loop != 0; do
  957.           iface=`expr $current - $loop`
  958.           loop=`expr $loop - 1`
  959.           verstring="$verstring:${iface}.0"
  960.         done
  961.  
  962.         # Make executables depend on our current version.
  963.         verstring="$verstring:${current}.0"
  964.         ;;
  965.  
  966.       sunos)
  967.         version_vars="$version_vars major versuffix"
  968.         major="$current"
  969.         versuffix="$current.$revision"
  970.         ;;
  971.  
  972.       *)
  973.         $echo "$modename: unknown library version type \`$version_type'" 1>&2
  974.         echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  975.         exit 1
  976.         ;;
  977.       esac
  978.  
  979.       # Create the output directory, or remove our outputs if we need to.
  980.       if test -d $objdir; then
  981.         $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
  982.         $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
  983.       else
  984.         $show "$mkdir $objdir"
  985.         $run $mkdir $objdir
  986.     status=$?
  987.     if test $status -eq 0 || test -d $objdir; then :
  988.     else
  989.       exit $status
  990.     fi
  991.       fi
  992.  
  993.       # Check to see if the archive will have undefined symbols.
  994.       if test "$allow_undefined" = yes; then
  995.         if test "$allow_undefined_flag" = unsupported; then
  996.           $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  997.           build_libtool_libs=no
  998.       build_old_libs=yes
  999.         fi
  1000.       else
  1001.         # Don't allow undefined symbols.
  1002.         allow_undefined_flag="$no_undefined_flag"
  1003.       fi
  1004.  
  1005.       # Add libc to deplibs on all systems.
  1006.       dependency_libs="$deplibs"
  1007.       deplibs="$deplibs -lc"
  1008.  
  1009.       if test "$build_libtool_libs" = yes; then
  1010.         # Get the real and link names of the library.
  1011.         eval library_names=\"$library_names_spec\"
  1012.         set dummy $library_names
  1013.         realname="$2"
  1014.         shift; shift
  1015.  
  1016.         if test -n "$soname_spec"; then
  1017.           eval soname=\"$soname_spec\"
  1018.         else
  1019.           soname="$realname"
  1020.         fi
  1021.  
  1022.         lib="$objdir/$realname"
  1023.     for link
  1024.     do
  1025.       linknames="$linknames $link"
  1026.     done
  1027.  
  1028.         # Use standard objects if they are PIC.
  1029.         test -z "$pic_flag" && libobjs="$olibobjs"
  1030.  
  1031.         # Do each of the archive commands.
  1032.         eval cmds=\"$archive_cmds\"
  1033.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1034.         for cmd in $cmds; do
  1035.           IFS="$save_ifs"
  1036.           $show "$cmd"
  1037.           $run eval "$cmd" || exit $?
  1038.         done
  1039.         IFS="$save_ifs"
  1040.  
  1041.         # Create links to the real library.
  1042.         for linkname in $linknames; do
  1043.           $show "(cd $objdir && $LN_S $realname $linkname)"
  1044.           $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
  1045.         done
  1046.  
  1047.         # If -export-dynamic was specified, set the dlname.
  1048.         if test "$export_dynamic" = yes; then
  1049.           # On all known operating systems, these are identical.
  1050.           dlname="$soname"
  1051.         fi
  1052.       fi
  1053.  
  1054.       # Now set the variables for building old libraries.
  1055.       oldlib="$objdir/$libname.a"
  1056.       ;;
  1057.  
  1058.     *.lo | *.o)
  1059.       if test -n "$link_against_libtool_libs"; then
  1060.         $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2
  1061.         exit 1
  1062.       fi
  1063.  
  1064.       if test -n "$deplibs"; then
  1065.         $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
  1066.       fi
  1067.  
  1068.       if test -n "$dlfiles$dlprefiles"; then
  1069.         $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2
  1070.         # Nullify the symbol file.
  1071.         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  1072.         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  1073.       fi
  1074.  
  1075.       if test -n "$rpath"; then
  1076.         $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2
  1077.       fi
  1078.  
  1079.       if test -n "$vinfo"; then
  1080.         $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2
  1081.       fi
  1082.  
  1083.       if test -n "$release"; then
  1084.         $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
  1085.       fi
  1086.  
  1087.       case "$output" in
  1088.       *.lo)
  1089.         if test -n "$objs"; then
  1090.           $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  1091.           exit 1
  1092.         fi
  1093.         libobj="$output"
  1094.         obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
  1095.         ;;
  1096.       *)
  1097.         libobj=
  1098.         obj="$output"
  1099.         ;;
  1100.       esac
  1101.  
  1102.       # Delete the old objects.
  1103.       $run $rm $obj $libobj
  1104.  
  1105.       # Create the old-style object.
  1106.       reload_objs="$objs $olibobjs"
  1107.  
  1108.       output="$obj"
  1109.       eval cmds=\"$reload_cmds\"
  1110.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1111.       for cmd in $cmds; do
  1112.         IFS="$save_ifs"
  1113.         $show "$cmd"
  1114.         $run eval "$cmd" || exit $?
  1115.       done
  1116.       IFS="$save_ifs"
  1117.  
  1118.       # Exit if we aren't doing a library object file.
  1119.       test -z "$libobj" && exit 0
  1120.  
  1121.       if test "$build_libtool_libs" != yes; then
  1122.         # Create an invalid libtool object if no PIC, so that we don't
  1123.         # accidentally link it into a program.
  1124.         $show "echo timestamp > $libobj"
  1125.         $run eval "echo timestamp > $libobj" || exit $?
  1126.         exit 0
  1127.       fi
  1128.  
  1129.       if test -n "$pic_flag"; then
  1130.         # Only do commands if we really have different PIC objects.
  1131.         reload_objs="$libobjs"
  1132.         output="$libobj"
  1133.         eval cmds=\"$reload_cmds\"
  1134.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1135.         for cmd in $cmds; do
  1136.           IFS="$save_ifs"
  1137.           $show "$cmd"
  1138.           $run eval "$cmd" || exit $?
  1139.         done
  1140.         IFS="$save_ifs"
  1141.       else
  1142.         # Just create a symlink.
  1143.         $show "$LN_S $obj $libobj"
  1144.         $run $LN_S $obj $libobj || exit 1
  1145.       fi
  1146.  
  1147.       exit 0
  1148.       ;;
  1149.  
  1150.     *)
  1151.       if test -n "$vinfo"; then
  1152.         $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2
  1153.       fi
  1154.  
  1155.       if test -n "$release"; then
  1156.         $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
  1157.       fi
  1158.  
  1159.       if test -n "$rpath"; then
  1160.     # If the user specified any rpath flags, then add them.
  1161.     for libdir in $rpath; do
  1162.           if test -n "$hardcode_libdir_flag_spec"; then
  1163.             if test -n "$hardcode_libdir_separator"; then
  1164.               if test -z "$hardcode_libdirs"; then
  1165.                 # Put the magic libdir with the hardcode flag.
  1166.                 hardcode_libdirs="$libdir"
  1167.                 libdir="@HARDCODE_LIBDIRS@"
  1168.               else
  1169.                 # Just accumulate the unique libdirs.
  1170.         case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1171.         *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1172.           ;;
  1173.         *)
  1174.           hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  1175.           ;;
  1176.         esac
  1177.                 libdir=
  1178.               fi
  1179.             fi
  1180.  
  1181.             if test -n "$libdir"; then
  1182.               eval flag=\"$hardcode_libdir_flag_spec\"
  1183.  
  1184.               compile_command="$compile_command $flag"
  1185.               finalize_command="$finalize_command $flag"
  1186.             fi
  1187.           elif test -n "$runpath_var"; then
  1188.             case "$perm_rpath " in
  1189.             *" $libdir "*) ;;
  1190.             *) perm_rpath="$perm_rpath $libdir" ;;
  1191.             esac
  1192.           fi
  1193.     done
  1194.       fi
  1195.  
  1196.       # Substitute the hardcoded libdirs into the compile commands.
  1197.       if test -n "$hardcode_libdir_separator"; then
  1198.     compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  1199.     finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  1200.       fi
  1201.  
  1202.       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  1203.         # Transform all the library objects into standard objects.
  1204.         compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1205.         finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1206.       fi
  1207.  
  1208.       if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
  1209.         dlsyms="${output}S.c"
  1210.       else
  1211.         dlsyms=
  1212.       fi
  1213.  
  1214.       if test -n "$dlsyms"; then
  1215.         # Add our own program objects to the preloaded list.
  1216.         dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1217.  
  1218.     # Discover the nlist of each of the dlfiles.
  1219.         nlist="$objdir/${output}.nm"
  1220.  
  1221.     if test -d $objdir; then
  1222.       $show "$rm $nlist ${nlist}T"
  1223.       $run $rm "$nlist" "${nlist}T"
  1224.     else
  1225.       $show "$mkdir $objdir"
  1226.       $run $mkdir $objdir
  1227.       status=$?
  1228.       if test $status -eq 0 || test -d $objdir; then :
  1229.       else
  1230.         exit $status
  1231.       fi
  1232.     fi
  1233.  
  1234.         for arg in $dlprefiles; do
  1235.       $show "extracting global C symbols from \`$arg'"
  1236.       $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  1237.         done
  1238.  
  1239.         # Parse the name list into a source file.
  1240.         $show "creating $objdir/$dlsyms"
  1241.         if test -z "$run"; then
  1242.       # Make sure we at least have an empty file.
  1243.       test -f "$nlist" || : > "$nlist"
  1244.  
  1245.       # Try sorting and uniquifying the output.
  1246.       if sort "$nlist" | uniq > "$nlist"T; then
  1247.         mv -f "$nlist"T "$nlist"
  1248.         wcout=`wc "$nlist" 2>/dev/null`
  1249.         count=`echo "X$wcout" | $Xsed -e 's/^[     ]*\([0-9][0-9]*\).*$/\1/'`
  1250.         (test "$count" -ge 0) 2>/dev/null || count=-1
  1251.       else
  1252.         $rm "$nlist"T
  1253.         count=-1
  1254.       fi
  1255.  
  1256.       case "$dlsyms" in
  1257.       "") ;;
  1258.       *.c)
  1259.         $echo > "$objdir/$dlsyms" "\
  1260. /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
  1261. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
  1262.  
  1263. #ifdef __cplusplus
  1264. extern \"C\" {
  1265. #endif
  1266.  
  1267. /* Prevent the only kind of declaration conflicts we can make. */
  1268. #define dld_preloaded_symbol_count some_other_symbol
  1269. #define dld_preloaded_symbols some_other_symbol
  1270.  
  1271. /* External symbol declarations for the compiler. */\
  1272. "
  1273.  
  1274.         if test -f "$nlist"; then
  1275.           sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
  1276.         else
  1277.           echo '/* NONE */' >> "$objdir/$dlsyms"
  1278.         fi
  1279.  
  1280.         $echo >> "$objdir/$dlsyms" "\
  1281.  
  1282. #undef dld_preloaded_symbol_count
  1283. #undef dld_preloaded_symbols
  1284.  
  1285. #if defined (__STDC__) && __STDC__
  1286. # define __ptr_t void *
  1287. #else
  1288. # define __ptr_t char *
  1289. #endif
  1290.  
  1291. /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
  1292. int dld_preloaded_symbol_count = $count;
  1293.  
  1294. /* The mapping between symbol names and symbols. */
  1295. struct {
  1296.   char *name;
  1297.   __ptr_t address;
  1298. }
  1299. dld_preloaded_symbols[] =
  1300. {\
  1301. "
  1302.  
  1303.         if test -f "$nlist"; then
  1304.           sed 's/^\(.*\) \(.*\)$/  {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
  1305.         fi
  1306.  
  1307.         $echo >> "$objdir/$dlsyms" "\
  1308.   {0, (__ptr_t) 0}
  1309. };
  1310.  
  1311. #ifdef __cplusplus
  1312. }
  1313. #endif\
  1314. "
  1315.         ;;
  1316.  
  1317.       *)
  1318.         $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  1319.         exit 1
  1320.         ;;
  1321.       esac
  1322.         fi
  1323.  
  1324.         # Now compile the dynamic symbol file.
  1325.         $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
  1326.         $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
  1327.  
  1328.         # Transform the symbol file into the correct name.
  1329.         compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
  1330.         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
  1331.       elif test "$export_dynamic" != yes; then
  1332.         test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
  1333.       else
  1334.         # We keep going just in case the user didn't refer to
  1335.         # dld_preloaded_symbols.  The linker will fail if global_symbol_pipe
  1336.         # really was required.
  1337.         $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  1338.  
  1339.         # Nullify the symbol file.
  1340.         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  1341.         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  1342.       fi
  1343.  
  1344.       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  1345.         # Replace the output file specification.
  1346.         compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1347.         finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1348.  
  1349.         # We have no uninstalled library dependencies, so finalize right now.
  1350.         $show "$compile_command"
  1351.         $run eval "$compile_command"
  1352.         exit $?
  1353.       fi
  1354.  
  1355.       # Replace the output file specification.
  1356.       compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
  1357.       finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
  1358.  
  1359.       # Create the binary in the object directory, then wrap it.
  1360.       if test -d $objdir; then :
  1361.       else
  1362.         $show "$mkdir $objdir"
  1363.     $run $mkdir $objdir
  1364.     status=$?
  1365.     if test $status -eq 0 || test -d $objdir; then :
  1366.     else
  1367.       exit $status
  1368.     fi
  1369.       fi
  1370.  
  1371.       if test -n "$shlibpath_var"; then
  1372.         # We should set the shlibpath_var
  1373.         rpath=
  1374.         for dir in $temp_rpath; do
  1375.           case "$dir" in
  1376.           /* | [A-Za-z]:\\*)
  1377.             # Absolute path.
  1378.             rpath="$rpath$dir:"
  1379.             ;;
  1380.           *)
  1381.             # Relative path: add a thisdir entry.
  1382.             rpath="$rpath\$thisdir/$dir:"
  1383.             ;;
  1384.           esac
  1385.         done
  1386.         temp_rpath="$rpath"
  1387.       fi
  1388.  
  1389.       # Delete the old output file.
  1390.       $run $rm $output
  1391.  
  1392.       if test -n "$compile_shlibpath"; then
  1393.         compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
  1394.       fi
  1395.       if test -n "$finalize_shlibpath"; then
  1396.         finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  1397.       fi
  1398.  
  1399.       if test -n "$runpath_var" && test -n "$perm_rpath"; then
  1400.         # We should set the runpath_var.
  1401.         rpath=
  1402.         for dir in $perm_rpath; do
  1403.           rpath="$rpath$dir:"
  1404.         done
  1405.         compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
  1406.         finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
  1407.       fi
  1408.  
  1409.       case "$hardcode_action" in
  1410.       relink)
  1411.         # AGH! Flame the AIX and HP-UX people for me, will ya?
  1412.         $echo "$modename: warning: using a buggy system linker" 1>&2
  1413.         $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
  1414.         ;;
  1415.       esac
  1416.  
  1417.       $show "$compile_command"
  1418.       $run eval "$compile_command" || exit $?
  1419.  
  1420.       # Now create the wrapper script.
  1421.       $show "creating $output"
  1422.  
  1423.       # Quote the finalize command for shipping.
  1424.       finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
  1425.  
  1426.       # Quote $echo for shipping.
  1427.       qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  1428.  
  1429.       # Only actually do things if our run command is non-null.
  1430.       if test -z "$run"; then
  1431.         $rm $output
  1432.         trap "$rm $output; exit 1" 1 2 15
  1433.  
  1434.         $echo > $output "\
  1435. #! /bin/sh
  1436.  
  1437. # $output - temporary wrapper script for $objdir/$output
  1438. # Generated by ltmain.sh - GNU $PACKAGE $VERSION
  1439. #
  1440. # The $output program cannot be directly executed until all the libtool
  1441. # libraries that it depends on are installed.
  1442. #
  1443. # This wrapper script should never be moved out of \``pwd`'.
  1444. # If it is, it will not operate correctly.
  1445.  
  1446. # Sed substitution that helps us do robust quoting.  It backslashifies
  1447. # metacharacters that are still active within double-quoted strings.
  1448. Xsed='sed -e s/^X//'
  1449. sed_quote_subst='$sed_quote_subst'
  1450.  
  1451. # The HP-UX ksh and POSIX shell print the target directory to stdout
  1452. # if CDPATH is set.
  1453. if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
  1454.  
  1455. # This environment variable determines our operation mode.
  1456. if test \"\$libtool_install_magic\" = \"$magic\"; then
  1457.   # install mode needs the following variables:
  1458.   link_against_libtool_libs='$link_against_libtool_libs'
  1459.   finalize_command=\"$finalize_command\"
  1460. else
  1461.   # When we are sourced in execute mode, \$file and \$echo are already set.
  1462.   if test \"\$libtool_execute_magic\" = \"$magic\"; then :
  1463.   else
  1464.     echo=\"$qecho\"
  1465.     file=\"\$0\"
  1466.   fi\
  1467. "
  1468.         $echo >> $output "\
  1469.  
  1470.   # Find the directory that this script lives in.
  1471.   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  1472.   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  1473.  
  1474.   # Follow symbolic links until we get to the real thisdir.
  1475.   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  1476.   while test -n \"\$file\"; do
  1477.     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  1478.  
  1479.     # If there was a directory component, then change thisdir.
  1480.     if test \"x\$destdir\" != \"x\$file\"; then
  1481.       case \"\$destdir\" in
  1482.       /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;;
  1483.       *) thisdir=\"\$thisdir/\$destdir\" ;;
  1484.       esac
  1485.     fi
  1486.  
  1487.     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  1488.     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  1489.   done
  1490.  
  1491.   # Try to get the absolute directory name.
  1492.   absdir=\`cd \"\$thisdir\" && pwd\`
  1493.   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  1494.  
  1495.   progdir=\"\$thisdir/$objdir\"
  1496.   program='$output'
  1497.  
  1498.   if test -f \"\$progdir/\$program\"; then"
  1499.  
  1500.         # Export our shlibpath_var if we have one.
  1501.         if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  1502.           $echo >> $output "\
  1503.     # Add our own library path to $shlibpath_var
  1504.     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  1505.  
  1506.     # Some systems cannot cope with colon-terminated $shlibpath_var
  1507.     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
  1508.  
  1509.     export $shlibpath_var
  1510. "
  1511.         fi
  1512.  
  1513.         $echo >> $output "\
  1514.     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  1515.       # Run the actual program with our arguments.
  1516.  
  1517.       # Export the path to the program.
  1518.       PATH=\"\$progdir:\$PATH\"
  1519.       export PATH
  1520.  
  1521.       exec \$program \${1+\"\$@\"}
  1522.  
  1523.       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  1524.       exit 1
  1525.     fi
  1526.   else
  1527.     # The program doesn't exist.
  1528.     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  1529.     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  1530.     echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1531.     exit 1
  1532.   fi
  1533. fi\
  1534. "
  1535.         chmod +x $output
  1536.       fi
  1537.       exit 0
  1538.       ;;
  1539.     esac
  1540.  
  1541.     # See if we need to build an old-fashioned archive.
  1542.     if test "$build_old_libs" = "yes"; then
  1543.       # Transform .lo files to .o files.
  1544.       oldobjs="$objs $olibobjs"
  1545.  
  1546.       # Do each command in the archive commands.
  1547.       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  1548.     eval cmds=\"$old_archive_from_new_cmds\"
  1549.       else
  1550.     eval cmds=\"$old_archive_cmds\"
  1551.       fi
  1552.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1553.       for cmd in $cmds; do
  1554.         IFS="$save_ifs"
  1555.         $show "$cmd"
  1556.         $run eval "$cmd" || exit $?
  1557.       done
  1558.       IFS="$save_ifs"
  1559.     fi
  1560.  
  1561.     # Now create the libtool archive.
  1562.     case "$output" in
  1563.     *.la)
  1564.       old_library=
  1565.       test "$build_old_libs" = yes && old_library="$libname.a"
  1566.  
  1567.       $show "creating $output"
  1568.  
  1569.       # Only create the output if not a dry run.
  1570.       if test -z "$run"; then
  1571.         $echo > $output "\
  1572. # $output - a libtool library file
  1573. # Generated by ltmain.sh - GNU $PACKAGE $VERSION
  1574.  
  1575. # The name that we can dlopen(3).
  1576. dlname='$dlname'
  1577.  
  1578. # Names of this library.
  1579. library_names='$library_names'
  1580.  
  1581. # The name of the static archive.
  1582. old_library='$old_library'
  1583.  
  1584. # Libraries that this one depends upon.
  1585. dependency_libs='$dependency_libs'
  1586.  
  1587. # Version information for $libname.
  1588. current=$current
  1589. age=$age
  1590. revision=$revision
  1591.  
  1592. # Directory that this library needs to be installed in:
  1593. libdir='$install_libdir'\
  1594. "
  1595.       fi
  1596.  
  1597.       # Do a symbolic link so that the libtool archive can be found in
  1598.       # LD_LIBRARY_PATH before the program is installed.
  1599.       $show "(cd $objdir && $LN_S ../$output $output)"
  1600.       $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
  1601.       ;;
  1602.     esac
  1603.     exit 0
  1604.     ;;
  1605.  
  1606.   # libtool install mode
  1607.   install)
  1608.     modename="$modename: install"
  1609.  
  1610.     # There may be an optional /bin/sh argument at the beginning of
  1611.     # install_prog (especially on Windows NT).
  1612.     if test "$nonopt" = "$SHELL"; then
  1613.       # Aesthetically quote it.
  1614.       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  1615.       case "$arg" in
  1616.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1617.     arg="\"$arg\""
  1618.     ;;
  1619.       esac
  1620.       install_prog="$arg "
  1621.       arg="$1"
  1622.       shift
  1623.     else
  1624.       install_prog=
  1625.       arg="$nonopt"
  1626.     fi
  1627.  
  1628.     # The real first argument should be the name of the installation program.
  1629.     # Aesthetically quote it.
  1630.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1631.     case "$arg" in
  1632.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1633.       arg="\"$arg\""
  1634.       ;;
  1635.     esac
  1636.     install_prog="$install_prog$arg"
  1637.  
  1638.     # We need to accept at least all the BSD install flags.
  1639.     dest=
  1640.     files=
  1641.     opts=
  1642.     prev=
  1643.     install_type=
  1644.     isdir=
  1645.     stripme=
  1646.     for arg
  1647.     do
  1648.       if test -n "$dest"; then
  1649.         files="$files $dest"
  1650.         dest="$arg"
  1651.         continue
  1652.       fi
  1653.  
  1654.       case "$arg" in
  1655.       -d) isdir=yes ;;
  1656.       -f) prev="-f" ;;
  1657.       -g) prev="-g" ;;
  1658.       -m) prev="-m" ;;
  1659.       -o) prev="-o" ;;
  1660.       -s)
  1661.         stripme=" -s"
  1662.         continue
  1663.         ;;
  1664.       -*) ;;
  1665.  
  1666.       *)
  1667.         # If the previous option needed an argument, then skip it.
  1668.         if test -n "$prev"; then
  1669.           prev=
  1670.         else
  1671.           dest="$arg"
  1672.           continue
  1673.         fi
  1674.         ;;
  1675.       esac
  1676.  
  1677.       # Aesthetically quote the argument.
  1678.       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1679.       case "$arg" in
  1680.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1681.     arg="\"$arg\""
  1682.     ;;
  1683.       esac
  1684.       install_prog="$install_prog $arg"
  1685.     done
  1686.  
  1687.     if test -z "$install_prog"; then
  1688.       $echo "$modename: you must specify an install program" 1>&2
  1689.       $echo "$help" 1>&2
  1690.       exit 1
  1691.     fi
  1692.  
  1693.     if test -n "$prev"; then
  1694.       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  1695.       $echo "$help" 1>&2
  1696.       exit 1
  1697.     fi
  1698.  
  1699.     if test -z "$files"; then
  1700.       if test -z "$dest"; then
  1701.         $echo "$modename: no file or destination specified" 1>&2
  1702.       else
  1703.         $echo "$modename: you must specify a destination" 1>&2
  1704.       fi
  1705.       $echo "$help" 1>&2
  1706.       exit 1
  1707.     fi
  1708.  
  1709.     # Strip any trailing slash from the destination.
  1710.     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  1711.  
  1712.     # Check to see that the destination is a directory.
  1713.     test -d "$dest" && isdir=yes
  1714.     if test -n "$isdir"; then
  1715.       destdir="$dest"
  1716.       destname=
  1717.     else
  1718.       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  1719.       test "X$destdir" = "X$dest" && destdir=.
  1720.       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  1721.  
  1722.       # Not a directory, so check to see that there is only one file specified.
  1723.       set dummy $files
  1724.       if test $# -gt 2; then
  1725.         $echo "$modename: \`$dest' is not a directory" 1>&2
  1726.         $echo "$help" 1>&2
  1727.         exit 1
  1728.       fi
  1729.     fi
  1730.     case "$destdir" in
  1731.     /* | [A-Za-z]:\\*) ;;
  1732.     *)
  1733.       for file in $files; do
  1734.         case "$file" in
  1735.         *.lo) ;;
  1736.         *)
  1737.           $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  1738.           $echo "$help" 1>&2
  1739.           exit 1
  1740.           ;;
  1741.         esac
  1742.       done
  1743.       ;;
  1744.     esac
  1745.  
  1746.     # This variable tells wrapper scripts just to set variables rather
  1747.     # than running their programs.
  1748.     libtool_install_magic="$magic"
  1749.  
  1750.     staticlibs=
  1751.     future_libdirs=
  1752.     current_libdirs=
  1753.     for file in $files; do
  1754.  
  1755.       # Do each installation.
  1756.       case "$file" in
  1757.       *.a)
  1758.         # Do the static libraries later.
  1759.         staticlibs="$staticlibs $file"
  1760.         ;;
  1761.  
  1762.       *.la)
  1763.         # Check to see that this really is a libtool archive.
  1764.         if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
  1765.         else
  1766.           $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  1767.           $echo "$help" 1>&2
  1768.           exit 1
  1769.         fi
  1770.  
  1771.         library_names=
  1772.         old_library=
  1773.         # If there is no directory component, then add one.
  1774.         case "$file" in
  1775.         */* | *\\*) . $file ;;
  1776.         *) . ./$file ;;
  1777.         esac
  1778.  
  1779.         # Add the libdir to current_libdirs if it is the destination.
  1780.         if test "X$destdir" = "X$libdir"; then
  1781.           case "$current_libdirs " in
  1782.           *" $libdir "*) ;;
  1783.           *) current_libdirs="$current_libdirs $libdir" ;;
  1784.           esac
  1785.         else
  1786.           # Note the libdir as a future libdir.
  1787.           case "$future_libdirs " in
  1788.           *" $libdir "*) ;;
  1789.           *) future_libdirs="$future_libdirs $libdir" ;;
  1790.           esac
  1791.         fi
  1792.  
  1793.         dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  1794.         test "X$dir" = "X$file/" && dir=
  1795.         dir="$dir$objdir"
  1796.  
  1797.         # See the names of the shared library.
  1798.         set dummy $library_names
  1799.         if test -n "$2"; then
  1800.           realname="$2"
  1801.           shift
  1802.           shift
  1803.  
  1804.           # Install the shared library and build the symlinks.
  1805.           $show "$install_prog $dir/$realname $destdir/$realname"
  1806.           $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  1807.           test "X$dlname" = "X$realname" && dlname=
  1808.  
  1809.           if test $# -gt 0; then
  1810.             # Delete the old symlinks.
  1811.             rmcmd="$rm"
  1812.             for linkname
  1813.             do
  1814.               rmcmd="$rmcmd $destdir/$linkname"
  1815.             done
  1816.             $show "$rmcmd"
  1817.             $run $rmcmd
  1818.  
  1819.             # ... and create new ones.
  1820.             for linkname
  1821.             do
  1822.               test "X$dlname" = "X$linkname" && dlname=
  1823.               $show "(cd $destdir && $LN_S $realname $linkname)"
  1824.               $run eval "(cd $destdir && $LN_S $realname $linkname)"
  1825.             done
  1826.           fi
  1827.  
  1828.           if test -n "$dlname"; then
  1829.             # Install the dynamically-loadable library.
  1830.             $show "$install_prog $dir/$dlname $destdir/$dlname"
  1831.             $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
  1832.           fi
  1833.  
  1834.           # Do each command in the postinstall commands.
  1835.           lib="$destdir/$realname"
  1836.           eval cmds=\"$postinstall_cmds\"
  1837.           IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1838.           for cmd in $cmds; do
  1839.             IFS="$save_ifs"
  1840.             $show "$cmd"
  1841.             $run eval "$cmd" || exit $?
  1842.           done
  1843.           IFS="$save_ifs"
  1844.         fi
  1845.  
  1846.         # Install the pseudo-library for information purposes.
  1847.         name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1848.         $show "$install_prog $file $destdir/$name"
  1849.         $run eval "$install_prog $file $destdir/$name" || exit $?
  1850.  
  1851.         # Maybe install the static library, too.
  1852.         test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  1853.         ;;
  1854.  
  1855.       *.lo)
  1856.         # Install (i.e. copy) a libtool object.
  1857.  
  1858.         # Figure out destination file name, if it wasn't already specified.
  1859.         if test -n "$destname"; then
  1860.           destfile="$destdir/$destname"
  1861.         else
  1862.           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1863.           destfile="$destdir/$destfile"
  1864.         fi
  1865.  
  1866.         # Deduce the name of the destination old-style object file.
  1867.         case "$destfile" in
  1868.         *.lo)
  1869.           staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/\.o/'`
  1870.           ;;
  1871.         *.o)
  1872.           staticdest="$destfile"
  1873.           destfile=
  1874.           ;;
  1875.         *)
  1876.           $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  1877.           $echo "$help" 1>&2
  1878.           exit 1
  1879.           ;;
  1880.         esac
  1881.  
  1882.         # Install the libtool object if requested.
  1883.         if test -n "$destfile"; then
  1884.           $show "$install_prog $file $destfile"
  1885.           $run eval "$install_prog $file $destfile" || exit $?
  1886.         fi
  1887.  
  1888.         # Install the old object if enabled.
  1889.         if test "$build_old_libs" = yes; then
  1890.           # Deduce the name of the old-style object file.
  1891.           staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/\.o/'`
  1892.  
  1893.           $show "$install_prog $staticobj $staticdest"
  1894.           $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  1895.         fi
  1896.         exit 0
  1897.         ;;
  1898.  
  1899.       *)
  1900.         # Do a test to see if this is really a libtool program.
  1901.         if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
  1902.           link_against_libtool_libs=
  1903.           finalize_command=
  1904.  
  1905.           # If there is no directory component, then add one.
  1906.           case "$file" in
  1907.           */* | *\\*) . $file ;;
  1908.           *) . ./$file ;;
  1909.           esac
  1910.  
  1911.           # Check the variables that should have been set.
  1912.           if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
  1913.             $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  1914.             exit 1
  1915.           fi
  1916.  
  1917.           finalize=yes
  1918.           for lib in $link_against_libtool_libs; do
  1919.             # Check to see that each library is installed.
  1920.             libdir=
  1921.             if test -f "$lib"; then
  1922.               # If there is no directory component, then add one.
  1923.               case "$lib" in
  1924.               */* | *\\*) . $lib ;;
  1925.               *) . ./$lib ;;
  1926.               esac
  1927.             fi
  1928.             libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  1929.             if test -z "$libdir"; then
  1930.               $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2
  1931.             elif test -f "$libfile"; then :
  1932.             else
  1933.               $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  1934.               finalize=no
  1935.             fi
  1936.           done
  1937.  
  1938.           if test "$hardcode_action" = relink; then
  1939.             if test "$finalize" = yes; then
  1940.               $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
  1941.               $show "$finalize_command"
  1942.               if $run eval "$finalize_command"; then :
  1943.               else
  1944.                 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  1945.                 continue
  1946.               fi
  1947.               file="$objdir/$file"T
  1948.             else
  1949.               $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
  1950.             fi
  1951.           else
  1952.             # Install the binary that we compiled earlier.
  1953.         file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  1954.           fi
  1955.         fi
  1956.  
  1957.         $show "$install_prog$stripme $file $dest"
  1958.         $run eval "$install_prog\$stripme \$file \$dest" || exit $?
  1959.         ;;
  1960.       esac
  1961.     done
  1962.  
  1963.     for file in $staticlibs; do
  1964.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1965.  
  1966.       # Set up the ranlib parameters.
  1967.       oldlib="$destdir/$name"
  1968.  
  1969.       $show "$install_prog $file $oldlib"
  1970.       $run eval "$install_prog \$file \$oldlib" || exit $?
  1971.  
  1972.       # Do each command in the postinstall commands.
  1973.       eval cmds=\"$old_postinstall_cmds\"
  1974.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1975.       for cmd in $cmds; do
  1976.         IFS="$save_ifs"
  1977.         $show "$cmd"
  1978.         $run eval "$cmd" || exit $?
  1979.       done
  1980.       IFS="$save_ifs"
  1981.     done
  1982.  
  1983.     if test -n "$future_libdirs"; then
  1984.       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  1985.     fi
  1986.  
  1987.     if test -n "$current_libdirs"; then
  1988.       # Maybe just do a dry run.
  1989.       test -n "$run" && current_libdirs=" -n$current_libdirs"
  1990.       exec $SHELL $0 --finish$current_libdirs
  1991.       exit 1
  1992.     fi
  1993.  
  1994.     exit 0
  1995.     ;;
  1996.  
  1997.   # libtool finish mode
  1998.   finish)
  1999.     modename="$modename: finish"
  2000.     libdirs="$nonopt"
  2001.  
  2002.     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  2003.       for dir
  2004.       do
  2005.         libdirs="$libdirs $dir"
  2006.       done
  2007.  
  2008.       for libdir in $libdirs; do
  2009.     if test -n "$finish_cmds"; then
  2010.       # Do each command in the finish commands.
  2011.       eval cmds=\"$finish_cmds\"
  2012.           IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  2013.           for cmd in $cmds; do
  2014.             IFS="$save_ifs"
  2015.             $show "$cmd"
  2016.             $run eval "$cmd"
  2017.           done
  2018.           IFS="$save_ifs"
  2019.     fi
  2020.     if test -n "$finish_eval"; then
  2021.       # Do the single finish_eval.
  2022.       eval cmds=\"$finish_eval\"
  2023.       $run eval "$cmds"
  2024.     fi
  2025.       done
  2026.     fi
  2027.  
  2028.     echo "------------------------------------------------------------------------------"
  2029.     echo "Libraries have been installed in:"
  2030.     for libdir in $libdirs; do
  2031.       echo "   $libdir"
  2032.     done
  2033.     echo
  2034.     echo "To link against installed libraries in a given directory, LIBDIR,"
  2035.     echo "you must use the \`-LLIBDIR' flag during linking."
  2036.     echo
  2037.     echo " You will also need to do one of the following:"
  2038.     if test -n "$shlibpath_var"; then
  2039.       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  2040.       echo "     during execution"
  2041.     fi
  2042.     if test -n "$runpath_var"; then
  2043.       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  2044.       echo "     during linking"
  2045.     fi
  2046.     if test -n "$hardcode_libdir_flag_spec"; then
  2047.       libdir=LIBDIR
  2048.       eval flag=\"$hardcode_libdir_flag_spec\"
  2049.  
  2050.       echo "   - use the \`$flag' linker flag"
  2051.     fi
  2052.     if test -f /etc/ld.so.conf; then
  2053.       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  2054.     fi
  2055.     echo
  2056.     echo "See any operating system documentation about shared libraries for"
  2057.     echo "more information, such as the ld(1) and ld.so(8) manual pages."
  2058.     echo "------------------------------------------------------------------------------"
  2059.     exit 0
  2060.     ;;
  2061.  
  2062.   # libtool execute mode
  2063.   execute)
  2064.     modename="$modename: execute"
  2065.  
  2066.     # The first argument is the command name.
  2067.     cmd="$nonopt"
  2068.     if test -z "$cmd"; then
  2069.       $echo "$modename: you must specify a COMMAND" 1>&2
  2070.       $echo "$help"
  2071.       exit 1
  2072.     fi
  2073.  
  2074.     # Handle -dlopen flags immediately.
  2075.     for file in $execute_dlfiles; do
  2076.       if test -f "$file"; then :
  2077.       else
  2078.     $echo "$modename: \`$file' is not a file" 1>&2
  2079.     $echo "$help" 1>&2
  2080.     exit 1
  2081.       fi
  2082.  
  2083.       dir=
  2084.       case "$file" in
  2085.       *.la)
  2086.         # Check to see that this really is a libtool archive.
  2087.         if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then :
  2088.         else
  2089.           $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  2090.           $echo "$help" 1>&2
  2091.           exit 1
  2092.         fi
  2093.  
  2094.     # Read the libtool library.
  2095.     dlname=
  2096.     library_names=
  2097.  
  2098.         # If there is no directory component, then add one.
  2099.     case "$file" in
  2100.     */* | *\\*) . $file ;;
  2101.         *) . ./$file ;;
  2102.     esac
  2103.  
  2104.     # Skip this library if it cannot be dlopened.
  2105.     if test -z "$dlname"; then
  2106.       # Warn if it was a shared library.
  2107.       test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  2108.       continue
  2109.     fi
  2110.  
  2111.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  2112.     test "X$dir" = "X$file" && dir=.
  2113.  
  2114.     if test -f "$dir/$objdir/$dlname"; then
  2115.       dir="$dir/$objdir"
  2116.     else
  2117.       $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  2118.       exit 1
  2119.     fi
  2120.     ;;
  2121.  
  2122.       *.lo)
  2123.     # Just add the directory containing the .lo file.
  2124.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  2125.     test "X$dir" = "X$file" && dir=.
  2126.     ;;
  2127.  
  2128.       *)
  2129.     $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  2130.         continue
  2131.     ;;
  2132.       esac
  2133.  
  2134.       # Get the absolute pathname.
  2135.       absdir=`cd "$dir" && pwd`
  2136.       test -n "$absdir" && dir="$absdir"
  2137.  
  2138.       # Now add the directory to shlibpath_var.
  2139.       if eval "test -z \"\$$shlibpath_var\""; then
  2140.     eval "$shlibpath_var=\"\$dir\""
  2141.       else
  2142.     eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  2143.       fi
  2144.     done
  2145.  
  2146.     # This variable tells wrapper scripts just to set shlibpath_var
  2147.     # rather than running their programs.
  2148.     libtool_execute_magic="$magic"
  2149.  
  2150.     # Check if any of the arguments is a wrapper script.
  2151.     args=
  2152.     for file
  2153.     do
  2154.       case "$file" in
  2155.       -*) ;;
  2156.       *)
  2157.         # Do a test to see if this is really a libtool program.
  2158.         if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
  2159.       # If there is no directory component, then add one.
  2160.       case "$file" in
  2161.       */* | *\\*) . $file ;;
  2162.       *) . ./$file ;;
  2163.       esac
  2164.  
  2165.       # Transform arg to wrapped name.
  2166.       file="$progdir/$program"
  2167.     fi
  2168.         ;;
  2169.       esac
  2170.       # Quote arguments (to preserve shell metacharacters).
  2171.       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  2172.       args="$args \"$file\""
  2173.     done
  2174.  
  2175.     if test -z "$run"; then
  2176.       # Export the shlibpath_var.
  2177.       eval "export $shlibpath_var"
  2178.  
  2179.       # Now actually exec the command.
  2180.       eval "exec \$cmd$args"
  2181.  
  2182.       $echo "$modename: cannot exec \$cmd$args"
  2183.       exit 1
  2184.     else
  2185.       # Display what would be done.
  2186.       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  2187.       $echo "export $shlibpath_var"
  2188.       $echo "$cmd$args"
  2189.       exit 0
  2190.     fi
  2191.     ;;
  2192.  
  2193.   # libtool uninstall mode
  2194.   uninstall)
  2195.     modename="$modename: uninstall"
  2196.     rm="$nonopt"
  2197.     files=
  2198.  
  2199.     for arg
  2200.     do
  2201.       case "$arg" in
  2202.       -*) rm="$rm $arg" ;;
  2203.       *) files="$files $arg" ;;
  2204.       esac
  2205.     done
  2206.  
  2207.     if test -z "$rm"; then
  2208.       $echo "$modename: you must specify an RM program" 1>&2
  2209.       $echo "$help" 1>&2
  2210.       exit 1
  2211.     fi
  2212.  
  2213.     for file in $files; do
  2214.       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  2215.       test "X$dir" = "X$file" && dir=.
  2216.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  2217.  
  2218.       rmfiles="$file"
  2219.  
  2220.       case "$name" in
  2221.       *.la)
  2222.         # Possibly a libtool archive, so verify it.
  2223.         if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then
  2224.           . $dir/$name
  2225.  
  2226.           # Delete the libtool libraries and symlinks.
  2227.           for n in $library_names; do
  2228.             rmfiles="$rmfiles $dir/$n"
  2229.             test "X$n" = "X$dlname" && dlname=
  2230.           done
  2231.           test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
  2232.           test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  2233.  
  2234.       $show "$rm $rmfiles"
  2235.       $run $rm $rmfiles
  2236.  
  2237.       if test -n "$library_names"; then
  2238.         # Do each command in the postuninstall commands.
  2239.         eval cmds=\"$postuninstall_cmds\"
  2240.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  2241.         for cmd in $cmds; do
  2242.           IFS="$save_ifs"
  2243.           $show "$cmd"
  2244.           $run eval "$cmd"
  2245.         done
  2246.         IFS="$save_ifs"
  2247.       fi
  2248.  
  2249.           if test -n "$old_library"; then
  2250.         # Do each command in the old_postuninstall commands.
  2251.         eval cmds=\"$old_postuninstall_cmds\"
  2252.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  2253.         for cmd in $cmds; do
  2254.           IFS="$save_ifs"
  2255.           $show "$cmd"
  2256.           $run eval "$cmd"
  2257.         done
  2258.         IFS="$save_ifs"
  2259.       fi
  2260.  
  2261.           # FIXME: should reinstall the best remaining shared library.
  2262.         fi
  2263.         ;;
  2264.  
  2265.       *.lo)
  2266.         if test "$build_old_libs" = yes; then
  2267.           oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/\.o/'`
  2268.           rmfiles="$rmfiles $dir/$oldobj"
  2269.         fi
  2270.     $show "$rm $rmfiles"
  2271.     $run $rm $rmfiles
  2272.         ;;
  2273.  
  2274.       *)
  2275.           $show "$rm $rmfiles"
  2276.     $run $rm $rmfiles
  2277.     ;;
  2278.       esac
  2279.     done
  2280.     exit 0
  2281.     ;;
  2282.  
  2283.   "")
  2284.     $echo "$modename: you must specify a MODE" 1>&2
  2285.     $echo "$generic_help" 1>&2
  2286.     exit 1
  2287.     ;;
  2288.   esac
  2289.  
  2290.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  2291.   $echo "$generic_help" 1>&2
  2292.   exit 1
  2293. fi # test -z "$show_help"
  2294.  
  2295. # We need to display help for each of the modes.
  2296. case "$mode" in
  2297. "") $echo \
  2298. "Usage: $modename [OPTION]... [MODE-ARG]...
  2299.  
  2300. Provide generalized library-building support services.
  2301.  
  2302. -n, --dry-run         display commands without modifying any files
  2303.     --features        display configuration information and exit
  2304.     --finish          same as \`--mode=finish'
  2305.     --help            display this help message and exit
  2306.     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  2307.     --quiet           same as \`--silent'
  2308.     --silent          don't print informational messages
  2309.     --version         print version information
  2310.  
  2311. MODE must be one of the following:
  2312.  
  2313.       compile         compile a source file into a libtool object
  2314.       execute         automatically set library path, then run a program
  2315.       finish          complete the installation of libtool libraries
  2316.       install         install libraries or executables
  2317.       link            create a library or an executable
  2318.       uninstall       remove libraries from an installed directory
  2319.  
  2320. MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  2321. a more detailed description of MODE."
  2322.   exit 0
  2323.   ;;
  2324.  
  2325. compile)
  2326.   $echo \
  2327. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  2328.  
  2329. Compile a source file into a libtool library object.
  2330.  
  2331. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  2332. from the given SOURCEFILE.
  2333.  
  2334. The output file name is determined by removing the directory component from
  2335. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  2336. library object suffix, \`.lo'."
  2337.   ;;
  2338.  
  2339. execute)
  2340.   $echo \
  2341. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  2342.  
  2343. Automatically set library path, then run a program.
  2344.  
  2345. This mode accepts the following additional options:
  2346.  
  2347.   -dlopen FILE      add the directory containing FILE to the library path
  2348.  
  2349. This mode sets the library path environment variable according to \`-dlopen'
  2350. flags.
  2351.  
  2352. If any of the ARGS are libtool executable wrappers, then they are translated
  2353. into their corresponding uninstalled binary, and any of their required library
  2354. directories are added to the library path.
  2355.  
  2356. Then, COMMAND is executed, with ARGS as arguments."
  2357.   ;;
  2358.  
  2359. finish)
  2360.   $echo \
  2361. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  2362.  
  2363. Complete the installation of libtool libraries.
  2364.  
  2365. Each LIBDIR is a directory that contains libtool libraries.
  2366.  
  2367. The commands that this mode executes may require superuser privileges.  Use
  2368. the \`--dry-run' option if you just want to see what would be executed."
  2369.   ;;
  2370.  
  2371. install)
  2372.   $echo \
  2373. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  2374.  
  2375. Install executables or libraries.
  2376.  
  2377. INSTALL-COMMAND is the installation command.  The first component should be
  2378. either the \`install' or \`cp' program.
  2379.  
  2380. The rest of the components are interpreted as arguments to that command (only
  2381. BSD-compatible install options are recognized)."
  2382.   ;;
  2383.  
  2384. link)
  2385.   $echo \
  2386. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  2387.  
  2388. Link object files or libraries together to form another library, or to
  2389. create an executable program.
  2390.  
  2391. LINK-COMMAND is a command using the C compiler that you would use to create
  2392. a program from several object files.
  2393.  
  2394. The following components of LINK-COMMAND are treated specially:
  2395.  
  2396.   -all-static       do not do any dynamic linking at all
  2397.   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  2398.   -dlpreopen FILE   link in FILE and add its symbols to dld_preloaded_symbols
  2399.   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  2400.   -LLIBDIR          search LIBDIR for required installed libraries
  2401.   -lNAME            OUTPUT-FILE requires the installed library libNAME
  2402.   -no-undefined     declare that a library does not refer to external symbols
  2403.   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  2404.   -release RELEASE  specify package release information
  2405.   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  2406.   -static           do not do any dynamic linking of libtool libraries
  2407.   -version-info CURRENT[:REVISION[:AGE]]
  2408.                     specify library version info [each variable defaults to 0]
  2409.  
  2410. All other options (arguments beginning with \`-') are ignored.
  2411.  
  2412. Every other argument is treated as a filename.  Files ending in \`.la' are
  2413. treated as uninstalled libtool libraries, other files are standard or library
  2414. object files.
  2415.  
  2416. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
  2417. library objects (\`.lo' files) may be specified, and \`-rpath' is required.
  2418.  
  2419. If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
  2420. and \`ranlib'.
  2421.  
  2422. If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
  2423. created, otherwise an executable program is created."
  2424.   ;;
  2425.  
  2426. uninstall)
  2427.   $echo
  2428. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  2429.  
  2430. Remove libraries from an installation directory.
  2431.  
  2432. RM is the name of the program to use to delete files associated with each FILE
  2433. (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  2434. to RM.
  2435.  
  2436. If FILE is a libtool library, all the files associated with it are deleted.
  2437. Otherwise, only FILE itself is deleted using RM."
  2438.   ;;
  2439.  
  2440. *)
  2441.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  2442.   $echo "$help" 1>&2
  2443.   exit 1
  2444.   ;;
  2445. esac
  2446.  
  2447. echo
  2448. $echo "Try \`$modename --help' for more information about other modes."
  2449.  
  2450. exit 0
  2451.  
  2452. # Local Variables:
  2453. # mode:shell-script
  2454. # sh-indentation:2
  2455. # End:
  2456.